import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'Search.dart';
import 'Users.dart';


class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  Widget build(BuildContext context)=>Image.asset("lib/image/background.jpg");
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
  Widget row, status2;
  void Onpress() {
    //Navigator.push(context, MaterialPageRoute(builder: (context) =>Search()));
    showSearch(context:context ,delegate: SearchBarDelegate());
  }

  void initState() {
    row = Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        MaterialButton(
          height: 50,
          onPressed: () {
            Navigator.push(context, MaterialPageRoute(builder: (context) => Users()));
          },
          child: Text(
            '用户',
            style: TextStyle(
              fontStyle: FontStyle.normal,
              //letterSpacing: 10.0,
              fontSize: 15,
              fontWeight: FontWeight.w700,
            ),
          ),
          elevation: 1000,
          textColor: Colors.black,
          color: Colors.white,
        ),
        Container(
          decoration: BoxDecoration(
            border: new Border.all(color: Colors.white, width: 2.0),
          ),
          child: OutlineButton(onPressed: Onpress,
            highlightColor: Colors.white,
            child: Text('搜索',
              style: TextStyle(
                fontStyle: FontStyle.normal,
                //letterSpacing: 10.0,
                     fontSize: 15,
                    fontWeight: FontWeight.w700,
                   ),
                  ),
                // elevation: 1000,
               textColor: Colors.white,
            //color: Colors.purple,
           ),
          margin: EdgeInsets.fromLTRB(30, 0, 0, 0),
        )
      ],
    );


  }
  @override
  Widget build(BuildContext context) =>
      new Scaffold(
          body: Container(
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage("lib/image/background.jpg"),
                fit: BoxFit.cover,
              ),
            ),
            child: Center(

              child: row,
            ),)
      );
}